package gamemodel;

public class PositionManager {

	private double angle; //angle in radians
	private int amplitude; 
	private float y; 
	private float radius; 
	
	public PositionManager(float y, float radius){
		this.angle = 0; 
		this.amplitude = 1;
		this.y = y; 
		this.radius = radius; 
	}
	
	
	public float computeValue(){
		
		double val =  this.y + (this.radius * 2 + Playground.RESET_SPACING) * amplitude * Math.sin(angle);
		
		if (angle != 0 && angle % (3 * Math.PI / 2) == 0){
			this.amplitude = this.amplitude + 1;
		}
		
		if (this.angle == 0){
			this.angle = Math.PI / 2; 
		} else {
			this.angle = this.angle + Math.PI;	
		}
		
		
		
		return (float) val; 
	}
	
	public void reset(){
		this.angle = 0; 
		this.amplitude = 1; 
	}

}
